<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>根据平均分来划分等级</title>
</head>
<body>
    <script>
        var chi=prompt("请输入语文成绩：");
        var mat=prompt("请输入数学成绩：");
        var eng=prompt("请输入英语成绩：");
        var che=prompt("请输入化学成绩：");
        var his=prompt("请输入历史成绩：");
        var average=(parseInt(chi)+parseInt(mat)+parseInt(eng)+parseInt(che)+parseInt(his))/5;
        alert("平均成绩为："+average);
        var lea=Math.floor(average/10);
        switch(lea){
            case 5:
                alert("很差");
                break;
                case 6:
                alert("较差");
                break;
                case 7:
                alert("一般");
                break;
                case 8:
                alert("良好");
                break;
                case 9:
                alert("优秀");
                break;
        }

    </script>
</body>
</html>